<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/js/jquery-ui-1.10.3.custom/css/custom-theme/jquery-ui-1.10.3.custom.min.css'); ?>" />
<!-- DATA TABLES -->
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/js/datatables/media/css/jquery.dataTables.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/js/datatables/media/assets/css/datatables.min.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/js/datatables/extras/TableTools/media/css/TableTools.min.css'); ?>" />				
<!-- MODALS -->
<div class="row">
    <div class="col-md-12">
        <!-- BOX -->
        <div class="box border orange">
            <div class="box-title">
                <h4><i class="fa fa-user-md"></i>List Operator</h4>
            </div>
            <div class="box-body">
                <table id="datatable1" cellpadding="0" cellspacing="0" border="0" class="datatable table table-striped table-bordered table-hover">
                    <p class="btn-toolbar">
                        <a href="<?php echo site_url('operator/tambah_operator'); ?>"><button class="btn btn-primary"><i class="fa fa-pencil"></i> Tambah Operator</button></a>
                    </p>
                    <thead>
                        <tr>
                            <th width="7px">No</th>
                            <th>Nama Operator</th>
                            <th>NIK</th>
                            <th>Jabatan</th>
                            <th>Email</th>
                            <th>Atasan Langsung</th>
                            <th>Bawahan Langsung</th>
                            <th>No HP</th>
                            <th class="hidden-xs">Status Operator</th>
                            <th>Option</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $no = 1;
                        foreach ($list as $l) {
                            ?>
                            <tr class="gradeX">
                                <td><?php echo $no++; ?></td>
                                <td><?php echo $l->nama; ?></td>
                                <td><?php echo $l->nik; ?></td>
                                <td><?php echo $l->jabatan; ?></td>
                                <td><?php echo $l->email; ?></td>
                                <td>
                                    <?php
                                    if (isset($atasan)) {
                                        $jml_data = $atasan[$l->id_operator]->num_rows();
                                        foreach ($atasan[$l->id_operator]->result() as $data_atasan_operator) {
                                            echo $data_atasan_operator->nama;
                                            echo $jml_data > 1 ? ', ' : ' ';
                                            $jml_data--;
                                        }
                                    }
                                    if ($atasan[$l->id_operator]->num_rows() == 0) {
                                        echo "Tidak Ada";
                                    }
                                    ?><br/>
                                </td>
                                <td>
                                    <?php
                                    if (isset($bawahan)) {
                                        $jml_data = $bawahan[$l->id_operator]->num_rows();
                                        foreach ($bawahan[$l->id_operator]->result() as $data_bawahan_operator) {
                                            echo $data_bawahan_operator->nama;
                                            echo $jml_data > 1 ? ', ' : ' ';
                                            $jml_data--;
                                        }
                                    }
                                    if ($bawahan[$l->id_operator]->num_rows() == 0) {
                                        echo "Tidak Ada";
                                    }
                                    ?><br/>
                                </td>
                                <td><?php echo $l->no_hp; ?></td>
                                <td class="center">
                                    <?php
                                    if ($l->status == 1)
                                        echo "Aktif";
                                    else
                                        echo "Non-Aktif";
                                    ?>
                                </td>
                                <td class="center hidden-xs">
                                    <a href="<?php echo site_url('operator/edit_operator/') . '/' . $l->id_operator; ?>"><i class="fa fa-edit fa-fw tip-bottom" title="edit"></i></a>
                                    <a href="<?php echo site_url('operator/peta') . '/' . $l->id_operator; ?>"><i class="fa fa-map-marker fa-fw tip-bottom" title="peta"></i></a>
                                    <a href="<?php echo site_url('operator/hapus_operator') . '/' . $l->id_operator; ?>" onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?');"><i class="fa fa-times fa-fw tip-bottom" title="hapus"></i></a>
                                </td>
                            </tr>
                        <?php } ?>
                    </tbody>
                </table>
            </div>
        </div>
        <!-- /BOX -->
    </div>
</div>
<!-- /MODALS -->
<div class="footer-tools">
    <span class="go-top">
        <i class="fa fa-chevron-up"></i> Top
    </span>
</div>
<!-- JAVASCRIPTS -->
<!-- Placed at the end of the document so the pages load faster -->
<!-- JQUERY -->
<script src="<?php echo base_url('assets/js/jquery/jquery-2.0.3.min.js'); ?>"></script>
<!-- JQUERY UI-->
<script src="<?php echo base_url('assets/js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js'); ?>"></script>
<!-- BOOTSTRAP -->
<script src="<?php echo base_url('assets/bootstrap-dist/js/bootstrap.min.js'); ?>"></script>


<!-- DATE RANGE PICKER -->
<script src="<?php echo base_url('assets/js/bootstrap-daterangepicker/moment.min.js'); ?>"></script>

<script src="<?php echo base_url('assets/js/bootstrap-daterangepicker/daterangepicker.min.js'); ?>"></script>
<!-- SLIMSCROLL -->
<script type="text/javascript" src="<?php echo base_url('assets/js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js'); ?>"></script>
<!-- BLOCK UI -->
<script type="text/javascript" src="<?php echo base_url('assets/js/jQuery-BlockUI/jquery.blockUI.min.js'); ?>"></script>

<!-- BOOTBOX -->
<script type="text/javascript" src="<?php echo base_url('assets/js/bootbox/bootbox.min.js'); ?>"></script>

<!-- TYPEHEAD -->
<script type="text/javascript" src="<?php echo base_url() . 'assets/js/typeahead/typeahead.min.js'; ?>"></script>
<!-- AUTOSIZE -->
<script type="text/javascript" src="<?php echo base_url() . 'assets/js/autosize/jquery.autosize.min.js'; ?>"></script>
<!-- COUNTABLE -->
<script type="text/javascript" src="<?php echo base_url() . 'assets/js/countable/jquery.simplyCountable.min.js'; ?>"></script>
<!-- INPUT MASK -->
<script type="text/javascript" src="<?php echo base_url() . 'assets/js/bootstrap-inputmask/bootstrap-inputmask.min.js'; ?>"></script>
<!-- FILE UPLOAD -->
<script type="text/javascript" src="<?php echo base_url() . 'assets/js/bootstrap-fileupload/bootstrap-fileupload.min.js'; ?>"></script>
<!-- SELECT2 -->
<script type="text/javascript" src="<?php echo base_url() . 'assets/js/select2/select2.min.js'; ?>"></script>
<!-- UNIFORM -->
<script type="text/javascript" src="<?php echo base_url() . 'assets/js/uniform/jquery.uniform.min.js'; ?>"></script>
<!-- JQUERY UPLOAD -->
<!-- The Templates plugin is included to render the upload/download listings -->
<script src="<?php echo base_url() . 'assets/js/blueimp/javascript-template/tmpl.min.js'; ?>"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<script src="<?php echo base_url() . 'assets/js/blueimp/javascript-loadimg/load-image.min.js'; ?>"></script>
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
<script src="<?php echo base_url() . 'assets/js/blueimp/javascript-canvas-to-blob/canvas-to-blob.min.js'; ?>"></script>
<!-- blueimp Gallery script -->
<script src="<?php echo base_url() . 'assets/js/blueimp/gallery/jquery.blueimp-gallery.min.js'; ?>"></script>
<!-- The basic File Upload plugin -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/jquery.fileupload.min.js'; ?>"></script>
<!-- The File Upload processing plugin -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/jquery.fileupload-process.min.js'; ?>"></script>
<!-- The File Upload image preview & resize plugin -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/jquery.fileupload-image.min.js'; ?>"></script>
<!-- The File Upload audio preview plugin -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/jquery.fileupload-audio.min.js'; ?>"></script>
<!-- The File Upload video preview plugin -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/jquery.fileupload-video.min.js'; ?>"></script>
<!-- The File Upload validation plugin -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/jquery.fileupload-validate.min.js'; ?>"></script>
<!-- The File Upload user interface plugin -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/jquery.fileupload-ui.min.js'; ?>"></script>
<!-- The main application script -->
<script src="<?php echo base_url() . 'assets/js/jquery-upload/js/main.js'; ?>"></script>

<!-- DATA TABLES -->
<script type="text/javascript" src="<?php echo base_url('assets/js/datatables/media/js/jquery.dataTables.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/datatables/media/assets/js/datatables.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/datatables/extras/TableTools/media/js/TableTools.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/js/datatables/extras/TableTools/media/js/ZeroClipboard.min.js'); ?>"></script>
<!-- COOKIE -->
<script type="text/javascript" src="<?php echo base_url('assets/js/jQuery-Cookie/jquery.cookie.min.js'); ?>"></script>
<!-- CUSTOM SCRIPT -->
<script src="<?php echo base_url('assets/js/script.js'); ?>"></script>
<script>
                                    jQuery(document).ready(function() {
                                        App.setPage("dynamic_table");  //Set current page
                                        App.init(); //Initialise plugins and elements
                                    });
</script>
<!-- /JAVASCRIPTS